-- Adds a /honk command

SARFFIX_HONK_COMMANDS					= {
	"/honk";
	"/honkings";
	"/honks";
	"/honkies";
};

SARFFIX_GENERAL_HONK					= "honks happily at everyone!";
SARFFIX_SPECIFIC_HONK					= "honks happily at %s!";


function SarfFix2_Honk(msg)
	local name = nil;
	if ( not msg ) or ( msg == "" ) then
		if ( UnitExists("target") ) then name = UnitName("target"); end
	else
		name = msg;
	end
	local emote = "";
	if name then 
		emote = format(SARFFIX_SPECIFIC_HONK, name);
	else 
		emote = SARFFIX_GENERAL_HONK;
	end
	SendChatMessage(emote, "EMOTE");
end

function SarfFix2:Honk_Initialize()

	local cmd = "HONK";
	SlashCmdList[cmd] = SarfFix2_Honk;
	cmd = "SLASH_"..cmd;
	for k, v in pairs(SARFFIX_HONK_COMMANDS) do
		setglobal(cmd..k, v);
	end
end

SarfFix2:AddInitializer("Honk_Initialize");
